home *** CD-ROM | disk | FTP | other *** search
- NAME VMODE
- TITLE 'VMODE---SET PC VIDEO MODE'
- ;
- ;RAY DUNCAN, SOFTTALK, JULY 83
- ;
- ;
- ; Vmode 0 40 * 25 Black and White Text.
- ; 1 40 * 25 Color Text.
- ; 2 80 * 25 Black and White Text.
- ; 3 80 * 25 Color Text.
- ;
- ; 4 320 * 200 Color Graphics.
- ; 5 320 * 200 Black and White Graphics.
- ; 6 640 * 200 Black and White Graphics.
- ; 7 Monochrome monitor.
- ;
- ;Assembler invocation A>ASM VMODE,VMODE,VMODE,VMODE
- ;Link invocation A>LINK VMODE,VMODE,,,
- ;
- ; *** The linker must be invoked with the 3 commas ***
- ; You will get a LINKER ERROR "missing STACK segment",
- ; Just ignore it it is because this is a .COM file and must
- ; conform to DOS requirements.
- ;
- ;Exe2bin invocation A>EXE2BIN VMODE.EXE,VMODE.COM
- ; and then..... A>ERASE VMODE.EXE
- ;
- ;
- INPUT EQU 080H ;Address of the command tail
- ;buffer created by DOS
- BLANK EQU 020H ;ASCII blank character
- CR EQU 00DH ;ASCII carriage return
- LF EQU 00AH ;ASCII line feed
- ;
- CSEG SEGMENT BYTE ;Set up for a .COM file.
- ASSUME CS:CSEG,DS:CSEG ;
- ORG 100H ;
- ;
- VMODE:
- ;
- ; These first 4 instructions detect invocation without command tail.
- ;
- MOV DI,OFFSET INPUT ;Init DI to address of the INPUT buffer
- MOV AL,[DI] ;move data pointed at by DI into AL
- OR AL,AL ;check for missing command tail (0+0=0).
- JZ VMODE7 ;if there is no command tail VMODE7 will exit us.
- ;
- ; Scan the Input buffer for a non-blank and check for valid mode#
- ;
- MOV AL,BLANK ;Move ASCII blank into AL.
- INC DI ;Increment DI one location in the INPUT buffer.
- MOV CX,80 ;Set the LOOP counter (CX) to 80. Max 80 char search.
- CLD ;Set the direction flag to 0, causing auto incr of DI.
- REPZ SCASB ;Repeat till CX=0, scan string (byte).
- JZ VMODE7 ;* If count down to zero means no match, so exit.
- MOV AL,-1[DI] ;Move the byte in DI-1 since DI will incr one more.
- CMP AL,CR ;Check for ASCII carriage return and
- JZ VMODE7 ; exit if it is.
- CMP AL,'0' ;Check to see if it is less than ASCII 0 .
- JB VMODE8 ;Jump if below to VMODE8 (illegal mode #).
- CMP AL,'7' ;Check for above ASCII 7.
- JA VMODE8 ;(illegal mode #)
- MOV VMODEB,AL ;Its legal, save it in ASCII form for VMODEB to disp.
- AND AL,0FH ;Mask upper four bits for true binary equivalent.
- PUSH AX ;Save numeric value on the stack.
- ;
- ;
- ;
- XOR BX,BX ;Force BX to = 0, and use it to
- MOV ES,BX ; set ES to 0
- MOV BX,410H ;Set BX to = DOS' euipment flag word.
- CMP AL,7 ;* check for monochrome or color board.
- MOV AL,30H ;Assume for now that it is monochrome.
- JZ VMODE6 ;It was monochrome, go set the mode.
- MOV AL,20H ;Wrong! It was color. fall thru to set the mode.
- ;
- VMODE6: ;Set the flags for new mode, calls video function 0,
- ; and sets DX to point to start of success mesage.
- ;
- AND BYTE PTR ES:[BX],0CFH ;Merge in the right flag
- OR ES:[BX],AL ; for new selected mode.
- POP AX ;Get the mode # from the stack.
- XOR AH,AH ;Clear the high byte of AX.
- INT 10H ;BIOS CALL see TECH REF pgs A-43, A-44.
- MOV DX,OFFSET VMODEA ;Set DX = to start of sucess string.
- JMP SHORT VMODE9 ;VMODE9 uses DOS CALL 21H to display strings.
- ;
- VMODE7:
- ;
- MOV DX,OFFSET VMODEC ;Cause DX to point at "missing mode #" msg.
- JMP SHORT VMODE9
- ;
- VMODE8:
- ;
- MOV DX,OFFSET VMODED ;Cause DX to point at "Illegal mode #" msg.
- ;
- VMODE9:
- ;
- MOV AH,9 ; set AH for function 9 of
- INT 21H ; Start display at address in DX, $ = terminate.
- INT 20H ; Causes return to DOS.
- ;
- VMODEA DB CR,LF
- DB 'VIDEO MODE SET TO... '
- ;
- VMODEB DB ' ',CR,LF,'$' ; Note that Vmodeb terminates text from Vmodea.
- VMODEC DB CR,LF
- DB 'MISSING MODE NUMBER.'
- DB CR,LF,'$'
- VMODED DB CR,LF
- DB 'ILLEGAL MODE NUMBER.'
- DB CR,LF,'$'
- CSEG ENDS
- END VMODE
-
-